package cn.slipi.admin.common.contants.enumtype;

import java.util.Arrays;

/**
 * TODO: 请添加描述
 *
 * @author lee
 * @date 2019/4/26
 * @since 1.0.0
 */
public enum CouponTimeTypeEnum {
    /**
     * 0：时间段，1：领券时间起N天，2：领券次日起N天
     */
    TIME_RANGE(0, "时间段"),

    TIME_CUR_N(1, "领券时间起N天"),

    TIME_NEXT_N(2, "领券次日起N天");

    private Integer value;
    private String desc;

    CouponTimeTypeEnum(Integer value, String desc) {
        this.value = value;
        this.desc = desc;
    }

    public static CouponTimeTypeEnum getByValue(int value) {
        return Arrays.stream(CouponTimeTypeEnum.values()).filter((t) -> t.getValue() == value).findFirst().get();
    }

    public Integer getValue() {
        return value;
    }

    public void setValue(Integer value) {
        this.value = value;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }
}
